//
//  XJFeatureItem.m
//  XinJiangMall
//
//  Created by RaoBo on 2018/5/9.
//  Copyright © 2018年 Tzyang. All rights reserved.
//  collectionView 的 item

#import "XJFeatureItem.h"
// Models
#import "XJFeatureItemModel.h"

// collectionCell 
@interface XJFeatureItem()
/**属性Lb*/
@property(nonatomic, strong) UILabel *attLb;

@end
@implementation XJFeatureItem
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI {
 
    self.attLb = [UILabel new];
    self.attLb.textAlignment = NSTextAlignmentCenter;
    self.attLb.layer.masksToBounds = YES;
    self.attLb.layer.cornerRadius = 5;
    [self addSubview:self.attLb];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    [self.attLb mas_makeConstraints:^(MASConstraintMaker *make) {
        // 和父View一样大
        make.edges.mas_equalTo(self);
    }];
}

- (void)setItemModel:(XJFeatureItemModel *)itemModel {
    _itemModel = itemModel;
    
//    self.attLb.text = itemModel.infoname;
    self.attLb.text = itemModel.name;
    
    if (itemModel.isSelect == YES) {
        self.attLb.backgroundColor = XJCOLOR_RGB(255, 218, 67);
    }else{
        self.attLb.backgroundColor = [UIColor whiteColor];
    }
}
@end
